#include <cstdio>

bool judge(int x) {
	while(x) {
		if(4 == x % 10) {
			return true;
		}

		x /= 10;
	}
	
	return false;
}

int main()
{
	int n, m, cnt = 0;

	scanf("%d%d", &n, &m);
	for(int i = n; i <= m; i++) {
		if(!judge(i)) {
			cnt++;
		}
	}
	
	printf("%d\n", cnt);

	return 0;
}